package com.dongdongshop.service.impl.content_category;

import com.dongdongshop.mapper.TbContentCategoryMapper;
import com.dongdongshop.pojo.content_category.TbContentCategory;
import com.dongdongshop.service.content_category.ContentCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@com.alibaba.dubbo.config.annotation.Service
public class ContentCategoryServiceImpl implements ContentCategoryService {
    @Autowired
    private TbContentCategoryMapper tbContentCategoryMapper;

    @Override
    public List<TbContentCategory> listContentCategory() {
        return tbContentCategoryMapper.selectByExample(null);
    }

    @Override
    public List<TbContentCategory> listCategory(String name) {
        return tbContentCategoryMapper.listCategory(name);
    }

    @Override
    public int insert(TbContentCategory category) {
        return tbContentCategoryMapper.insertSelective(category);
    }

    @Override
    public TbContentCategory getCategoryById(Long id) {
        return tbContentCategoryMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateCategory(TbContentCategory category) {
        return tbContentCategoryMapper.updateByPrimaryKeySelective(category);
    }

    @Override
    public int deleteCategory(Integer[] ids) {
        return tbContentCategoryMapper.deleteCategory(ids);
    }
}
